package com.selfdriving.dialog;

import android.app.Dialog;
import android.content.Context;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.Spinner;
import com.selfdriving.R;

public class SortDialog extends Dialog {
private Context context;

	public SortDialog(Context context) {
		super(context, R.style.dialog);
		setContentView(R.layout.sort_dialog);
		this.context =context;
		init();
	}

	private void init() {
		Spinner spinner1 = (Spinner) findViewById(R.id.spinner_1);
		Spinner spinner2 = (Spinner) findViewById(R.id.spinner_2);
		spinner1.setPrompt("请选择你要筛选的景点区域");
		ArrayAdapter<CharSequence> adapter = ArrayAdapter.createFromResource(context,
				R.array.city, android.R.layout.simple_spinner_item);
		adapter
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner1.setAdapter(adapter);
		
		spinner2.setPrompt("请选择你要筛选的景点区域");
		ArrayAdapter<CharSequence> adapter1 = ArrayAdapter.createFromResource(context,
				R.array.feature_sort_second, android.R.layout.simple_spinner_item);
		adapter1
				.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
		spinner2.setAdapter(adapter1);
		
		Button btnSure = (Button) findViewById(R.id.btnSure);
		Button btnCancel = (Button) findViewById(R.id.btnCancel);
		btnSure.setOnClickListener(new android.view.View.OnClickListener() {
			@Override
			public void onClick(View v) {
				SortDialog.this.dismiss();
			}
		});

		btnCancel.setOnClickListener(new android.view.View.OnClickListener() {
			@Override
			public void onClick(View v) {
				SortDialog.this.dismiss();
			}
		});
	}
}
